package models

import (
	"fmt"
	"github.com/beego/beego/v2/client/orm"
	"strconv"
)

func GetArticleList() []Article {
	o := orm.NewOrm()
	arr := o.QueryTable("article")
	var article []Article
	all, _ := arr.All(&article)
	fmt.Println(all)
	return article
}
func DeleteArticle(id []string) []Article {
	o := orm.NewOrm()
	atoi, _ := strconv.Atoi(id[0])
	shanchu := Article{Id: atoi}
	o.Delete(&shanchu)
	var article []Article
	arr := o.QueryTable("article")
	all, _ := arr.All(&article)
	fmt.Print(all)
	return article
}
